import requests

from api import SYSTEM_URL, SESSION
from utils.FakerDataUtil import FakerDataUtil


class UpdateUserPassword:

    def __init__(self):
        self.url = SYSTEM_URL + "/apis/api.console.halo.run/v1alpha1/users/"
        self.headers = {
            "Cookie": SESSION,
            "Content-Type": "application/json"
        }

    def update_user_password(self, username):

        body = {
            "password": FakerDataUtil.faker_password()
        }

        response = requests.put(self.url + str(username) + "/password", headers=self.headers, json=body)

        return response



